<?php
class Default_ServiceController extends Zend_Controller_Action {
	public function init() {
		/* Initialize action controller here */
		$this->newModel = new Default_Model_DbTable_News ();
		$this->_model = new Default_Model_DbTable_Photo ();
	}
	public function indexAction() {
		$maxId = $this->newModel->getNewsMaxId ( 13 );
		
		$maxNews = $this->newModel->getNewsById ( $maxId ['m'] );
		$this->view->maxNews = $maxNews;
		
		$intro = $this->newModel->getNewsByCategoryId1 ( 13, $maxId ['m'] );
		$this->view->intro = $intro;
	}
	public function designwebAction() {
		$maxId = $this->newModel->getNewsMaxId ( 22 );
		
		$maxNews = $this->newModel->getNewsById ( $maxId ['m'] );
		$this->view->maxNews = $maxNews;
		
		$intro = $this->newModel->getNewsByCategoryId1 ( 22, $maxId ['m'] );
		$this->view->intro = $intro;
// 		$this->view->allDesign = $this->_model->fetchAll ( "PHOTO_LIB_ID = 3" )->toArray ();
	}
	public function facebookserviceAction() {
		$maxId = $this->newModel->getNewsMaxId ( 21 );
		
		$maxNews = $this->newModel->getNewsById ( $maxId ['m'] );
		$this->view->maxNews = $maxNews;
		
		$intro = $this->newModel->getNewsByCategoryId1 ( 21, $maxId ['m'] );
		$this->view->intro = $intro;
	}
	public function smsAction() {
		$maxId = $this->newModel->getNewsMaxId ( 15 );
		
		$maxNews = $this->newModel->getNewsById ( $maxId ['m'] );
		$this->view->maxNews = $maxNews;
		
		$intro = $this->newModel->getNewsByCategoryId1 ( 15, $maxId ['m'] );
		$this->view->intro = $intro;
	}
	public function adverAction() {
		$maxId = $this->newModel->getNewsMaxId ( 16 );
		
		$maxNews = $this->newModel->getNewsById ( $maxId ['m'] );
		$this->view->maxNews = $maxNews;
		
		$intro = $this->newModel->getNewsByCategoryId1 ( 16, $maxId ['m'] );
		$this->view->intro = $intro;
	}
	public function domainAction() {
		$maxId = $this->newModel->getNewsMaxId ( 17 );
		
		$maxNews = $this->newModel->getNewsById ( $maxId ['m'] );
		$this->view->maxNews = $maxNews;
		
		$intro = $this->newModel->getNewsByCategoryId1 ( 17, $maxId ['m'] );
		$this->view->intro = $intro;
	}
	public function softAction() {
		$maxId = $this->newModel->getNewsMaxId ( 18 );
		
		$maxNews = $this->newModel->getNewsById ( $maxId ['m'] );
		$this->view->maxNews = $maxNews;
		
		$intro = $this->newModel->getNewsByCategoryId1 ( 18, $maxId ['m'] );
		$this->view->intro = $intro;
	}
	public function shownewsAction() {
		$id = $this->_getParam ( "id" );
		$news = $this->newModel->getNewsById ( $id );
		$this->view->News = $news;
		$catID = $news ["CATEGORY_ID"];
		$this->view->category = $this->newModel->getNewsByCategoryId ( $catID, $id );
		$this->newModel->addView ( $id );
		
	}
}

